const config=require('./config');
const passport = require('koa-passport');
const GithubStrategy = require('passport-github').Strategy;

passport.serializeUser(function(user, done) {
    //console.log('serializeUser>user:',user);
    done(null,user);
});

passport.deserializeUser(async function(user, done) {
    //console.log('deserializeUser>user:',user);
    done(null, user);
});


passport.use(new GithubStrategy({
        clientID:config.github.clientID,
        clientSecret:config.github.clientSecret,
        callbackURL:config.github.callbackURL
    },
    (token, tokenSecret, profile, done)=>{
/*        console.log('GithubStrategy callback>args>token:',token);
        console.log('GithubStrategy callback>args>tokenSecret',tokenSecret);
        console.log('GithubStrategy callback>args>profile:', profile);*/
        done(null,profile,token);
    }
));